<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="../static/css/bootstrap.css" />
    <!--需要在Javascript之前引入JQuer-->
    <script type="text/javascript" src="../static/js/jquery-1.11.0.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script type="text/javascript" src="../static/js/bootstrap.js"></script>
    <!--针对移动设备的样式，为了确保适当的绘制和触屏缩放-->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!--分页css-->
    <link rel="stylesheet" href="../static/css/pagination.css">
    <!--分页js-->
    <script src="../static/js/pagination.js"></script>
    <!--jquery.cookie.js-->
    <script src="../static/js/jquery.cookie.js"></script>
</head>
<body style="background-color: #eee;">
<div >
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="row clearfix" title="top">
                <div class="col-md-12 column">
                    <!--头部-->
                    <nav class="navbar-inverse container-fluid" role="navigation" style="background-color: #444;">
                        <div class="container-fluid" style="padding: 0 30px 0 30px;">
                            <div class="navbar-header">
                                <a class="navbar-brand" href="#">
                                    <font color="#F9F9F9">留言part</font>
                                </a>
                            </div>
                            <div>
                                <!--向左对齐-->
                                <ul class="nav navbar-nav navbar-left">
                                    <li class="dropdown">
                                        <a href="/2016" class="dropdown-toggle" >
                                            首页
                                        </a>
                                    </li>
                                </ul>
                                <!--向左对齐-文本-->
                                <!--向右对齐-->
                                <ul class="nav navbar-nav navbar-right">
                                    <li class="dropdown">
                                        <div class="navbar-form navbar-right">
                                            <div class="form-group">
                                                <div class="form-group">
                                                    <div class="input-group">
                                                        <input maxlength="15" size="35" type="text" class="form-control FuzzyVal" placeholder="代码改变世界" style="border-radius:25px;">
                                                        <span class="input-group-btn" style="right:40px">
                                                           <button onclick="Fuzzy(1)" class="btn btn-default FuzzyBtn" style="border: none;background: none;">
                                                            <span class="glyphicon glyphicon-search">
                                                            </span>
                                                            </button>
                                                        </span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <script>
                                            function Fuzzy(currentPage) {
                                                var FuzzyVal = $(".FuzzyVal").val();
                                                if (FuzzyVal != ""){
                                                    pageSize = 4;
                                                    offset = (currentPage - 1) * pageSize
                                                    offset = offset < 1 ? 0 : offset;
                                                    var messageListUrl = "/content/fuzzy?offset=" + offset + "&limit=" + pageSize+ "&value=" + FuzzyVal
                                                    $.post(messageListUrl, function (RspData, status) {
                                                        console.log(RspData);
                                                        console.log(status);
                                                        if (RspData.msgcount > 0) {
                                                            totalPages = Math.ceil(RspData.msgcount / pageSize)
                                                            console.log("status", totalPages)
                                                            new Pagination({
                                                                element: '#pages',
                                                                type: 1,
                                                                pageIndex: currentPage,
                                                                pageSize: 4,
                                                                total: RspData.msgcount,
                                                                jumper: true,
                                                                singlePageHide: false,
                                                                prevText: '上一页',
                                                                nextText: '下一页',
                                                                disabled: true,
                                                                currentChange: function (index) {
                                                                    // console.log(index);
                                                                    Fuzzy(index)
                                                                }
                                                            });
                                                            $("#msglistes").empty();
                                                            var trhtml = "";
                                                            //获取点赞的文章数组
                                                            var arr_M = [];
                                                            for (var m in RspData.thumbupIdList) {
                                                                var M_val = RspData.thumbupIdList[m].Message_id;
                                                                arr_M.push(M_val);
                                                            }
                                                            for (var i in RspData.data) {

                                                                //获取每一篇文章的点赞数
                                                                var Num = []
                                                                Num = jQuery.grep(arr_M, function( n, index ) {
                                                                    return ( n == RspData.data[i].M_id);
                                                                });
                                                                var HeartNum = Num.length;
                                                                //判断已点赞的文章
                                                                // var index1 = $.inArray(RspData.data[i].M_id,arr_M);
                                                                // if (index1 >= 0){
                                                                // 	var heartClass='glyphicon-heart';
                                                                // }else{
                                                                // 	var heartClass='glyphicon-heart-empty';
                                                                // }
                                                                var heartClass='glyphicon-heart-empty';
                                                                //判断登录用户与作者的用户名是否相同
                                                                //登录用户名
                                                                var login_username = $.cookie("login_username");
                                                                if(RspData.data[i].Name == login_username){
                                                                    var UpUrl ="/upmsgpage?msg_id="+RspData.data[i].M_id;
                                                                    var BtnHtml ="";
                                                                }else {
                                                                    BtnHtml ="";
                                                                }
                                                                //超级用户判断
                                                                if ("admin" == login_username){
                                                                    BtnHtml =
                                                                        "<a class=\"btn\" href=\"#\" onclick='Trash("+RspData.data[i].M_id+")'>" +
                                                                        "<span class=\"glyphicon glyphicon-trash\" style=\"color: rgb(255, 140, 60);\"></span>" +
                                                                        "</a>" ;
                                                                }
                                                                //截取正文字符串
                                                                var text = RspData.data[i].Text;
                                                                if (text.length > 110){
                                                                    text = text.slice(0,110);
                                                                }
                                                                //背景判断
                                                                var bgClasslen =$(".bgcolor").attr("class").length;
                                                                if(bgClasslen>20){
                                                                    var bgClass = "bgcolor_close";
                                                                }else {
                                                                    bgClass = "bgcolor_open";
                                                                }
                                                                trhtml += "<!--内容列表-->" +
                                                                    "<div class=\"list-group-item bgcolor_msg "+bgClass+"\" style=\"border-left: none; border-right: none;\" >" +
                                                                    "<article>" +
                                                                    "<section >" +
                                                                    "<div >" +
                                                                    "<h4>" +
                                                                    "<a  href=\"/basetext?msg_id="+RspData.data[i].M_id+"&num="+HeartNum+"\">"+RspData.data[i].Hdline+"</a>" +
                                                                    "</h4>" +
                                                                    "<div class=\"row clearfix\">" +
                                                                    "<div class=\"col-md-12 column\">" +
                                                                    "<div class=\"media\">" +
                                                                    "<a href=\"#\" class=\"pull-left\">" +
                                                                    "<img src=\"../static/img/header/"+RspData.data[i].Headpic+"\" width=\"70px\" height=\"70px\" class=\"media-object\" alt='' />" +
                                                                    "</a>" +
                                                                    "<div class=\"media-body\">" +
                                                                    text+"......"+
                                                                    "</div>" +
                                                                    "</div>" +
                                                                    "</div>" +
                                                                    "</div>" +
                                                                    "</div>" +
                                                                    "<footer style=\"padding-top: 10px;\">" +
                                                                    "<a href=\"#\">" +
                                                                    "<span>"+RspData.data[i].Name +"</span>" +
                                                                    "</a>" +
                                                                    "<span style=\"padding-left: 10px;\">" +
                                                                    "<span style=\"color: #777777;\">"+RspData.data[i].Cr_time +"</span>" +
                                                                    "</span>" +
                                                                    "<a class=\" btn \" href=\"#\" id="+'collect'+RspData.data[i].M_id+">" +
                                                                    "<span id='"+RspData.data[i].M_id+"'  class='"+heartClass+" glyphicon thumbUpBtn' style=\"color: rgb(255, 0, 0);\" data-container=\"body\" data-toggle=\"popover\" data-placement=\"top\" data-content=\"内容\"></span>" +
                                                                    "<span class='TmbNum'>"+HeartNum+"</span>" +
                                                                    "</a>" +
                                                                    "<a class=\" btn\" href=\"/basetext?msg_id="+RspData.data[i].M_id+"&num="+HeartNum+"\">" +
                                                                    "<span class=\"glyphicon glyphicon-eye-open\" style=\"color: rgb(175, 175, 230);\"></span>" +
                                                                    "</a>" +
                                                                    BtnHtml+
                                                                    "<span style=\"padding-right: 10px;float: right\">" +
                                                                    "<span class=\"glyphicon glyphicon-volume-up\" style=\"color: rgb(255, 0, 0);\">: <span style=\"color: rgb(0, 121, 184);\">"+RspData.data[i].Remark +"</span></span>" +
                                                                    "</span>" +
                                                                    "</footer>" +
                                                                    "</section>" +
                                                                    "<figure>" +
                                                                    "</figure>" +
                                                                    "</article>" +
                                                                    "</div>" +
                                                                    "<!--内容列表-->"
                                                                ;
                                                            }
                                                            $("#msglistes").html(trhtml);
                                                        }else {
                                                            alert("你输入的关键字，查询不到任何东西哦！");
                                                        }
                                                        //点赞处理
                                                    });
                                                }
                                            }
                                        </script>
                                    </li>
                                    <li>
                                        <a href="/login" class="" style="color: white;">登录</a>
                                    </li>
                                    <li>
                                        <a href="/user" class="" style="color: white;">注册</a>
                                    </li>
                                </ul>
                                <!-- <p class="navbar-text navbar-right">向右对齐-文本</p>-->
                            </div>
                        </div>
                    </nav>
                    <!--头部-->
                </div>
            </div>
            <div class="row clearfix" title="top_img">
                <div class="col-md-12 column">
                    <img src="../static/img/top_img.png" width="100%" height="30px" />
                </div>
            </div>
            <div class="row clearfix" title="main">
                <div class="col-md-12 column">
                    <div class="row clearfix" title="main_body">
                        <div class="col-md-1 column jumbotron" title="main_left">
                            <div style="height: 600px;">
                                <center>
                                    <div class="btn-group-vertical" >
                                        <button type="button" class="btn btn-default " style="border: none;background: none;">
                                            <a>
                                                <span class="glyphicon glyphicon-home" style="color: rgb(0, 0, 0); font-size: 10px;"> 全部</span>
                                            </a>
                                        </button>
                                        <button type="button" class="btn btn-default " style="border: none;background: none;">
                                            <a>
                                                <span class="glyphicon glyphicon-plus" style="color: rgb(0, 0, 0); font-size: 10px;"> 留言</span>
                                            </a>
                                        </button>
                                        <button type="button" class="btn btn-default " style="border: none;background: none;">
                                            <a>
                                                <span class="glyphicon glyphicon-book" style="color: rgb(0, 0, 0); font-size: 10px;"> 我评</span>
                                            </a>
                                        </button>
                                        <button type="button" class="btn btn-default " style="border: none;background: none;">
                                            <a>
                                                <span class="glyphicon glyphicon-heart" style="color: rgb(0, 0, 0); font-size: 10px;"> 喜欢</span>
                                            </a>
                                        </button>
                                        <br />
                                        <div class="btn-group-vertical">
                                            <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" style="border: none;background: none;">
                                                更多
                                                <span class="caret"></span>
                                            </button>
                                            <ul class="dropdown-menu" style="min-width: 110px">
                                                <li>
                                                    <a href="#">最新评论</a>
                                                </li>
                                                <li>
                                                    <a href="#">系统皮肤</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </center>
                            </div>
                        </div>
                        <div class="col-md-9 column " title="main_conter">
                            <div id="msglistes" class="list-group" style="height: 700px;background-color: #fff;">
                                <!--内容列表-->
                                <div class="list-group-item" style="border-left: none; border-right: none;">
                                    <article>
                                        <section >
                                            <div >
                                                <h4><a  href="https://www.cnblogs.com/xiaofengzai/p/14322092.html" target="_blank">Python-Flask搭建Web项目</a></h4>
                                                <div class="row clearfix">
                                                    <div class="col-md-12 column">
                                                        <div class="media">
                                                            <a href="#" class="pull-left"><img src="../static/img/header/cs40006.png" width="70px" height="70px" class="media-object" alt='' /></a>
                                                            <div class="media-body">
                                                                Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <footer style="padding-top: 10px;">
                                                <a href="https://www.cnblogs.com/xiaofengzai/">
                                                    <span>清风紫雪</span>
                                                </a>
                                                <span style="padding-left: 10px;">
                                                    <span style="color: #777777;">2021-01-24 20:04</span>
                                                </span>
                                                <a class=" btn " href="#" >
                                                    <span class="glyphicon glyphicon-thumbs-up" style="color: rgb(175, 175, 230);"></span>
                                                    <span>0</span>
                                                </a>
                                                <a class=" btn" href="">
                                                    <span class="glyphicon glyphicon-eye-open" style="color: rgb(175, 175, 230);"></span>
                                                </a>
                                            </footer>
                                        </section>
                                        <figure>
                                        </figure>
                                    </article>
                                </div>
                                <!--内容列表-->
                            </div>
                            <script>
                                //登录判断
                                $(function () {
                                    var u_id = $.cookie("userId");
                                    // alert("userid:::" + u_id.length);
                                    if ( Number(u_id) > 0) {
                                        window.location.replace("/content/detail");
                                    }


                                });
                                //
                                //遍历全部文章
                                pageAutoLoadData(1);
                                function  pageAutoLoadData(currentPage) {
                                    $("#msglistes").empty();
                                    $("#pages").prop({
                                        hidden: false
                                    });
                                    pageSize = 4;
                                    offset = (currentPage - 1) * pageSize
                                    offset = offset < 1 ? 0 : offset;
                                    var messageListUrl = "/content/getlist?offset=" + offset + "&limit=" + pageSize+ "&stu=" + 1
                                    $.get(messageListUrl, function (RspData, status) {
                                        console.log(RspData);
                                        console.log(status);
                                        if (RspData.msgcount > 0) {
                                            totalPages = Math.ceil(RspData.msgcount / pageSize)
                                            console.log("status", totalPages)
                                            new Pagination({
                                                element: '#pages',
                                                type: 1,
                                                pageIndex: currentPage,
                                                pageSize: 4,
                                                total: RspData.msgcount,
                                                jumper: true,
                                                singlePageHide: false,
                                                prevText: '上一页',
                                                nextText: '下一页',
                                                disabled: true,
                                                currentChange: function (index) {
                                                    // console.log(index);
                                                    pageAutoLoadData(index)
                                                }
                                            });
                                        }
                                        var trhtml = "";
                                        //获取点赞的文章数组
                                        var arr_M = [];
                                        for (var m in RspData.thumbupIdList) {
                                            var M_val = RspData.thumbupIdList[m].Message_id;
                                            arr_M.push(M_val);
                                        }
                                        for (var i in RspData.data) {
                                            //获取每一篇文章的点赞数
                                            var Num = []
                                            Num = jQuery.grep(arr_M, function( n, index ) {
                                                return ( n == RspData.data[i].M_id);
                                            });
                                            var HeartNum = Num.length;
                                            //判断已点赞的文章
                                            // var index1 = $.inArray(RspData.data[i].M_id,arr_M);
                                            // if (index1 >= 0){
                                            // 	var heartClass='glyphicon-heart';
                                            // }else{
                                            // 	var heartClass='glyphicon-heart-empty';
                                            // }
                                            var heartClass='glyphicon-heart-empty';
                                            //判断登录用户与作者的用户名是否相同
                                            //登录用户名
                                            var login_username = $.cookie("login_username");
                                            if(RspData.data[i].Name == login_username){
                                                var UpUrl ="/upmsgpage?msg_id="+RspData.data[i].M_id;
                                                var BtnHtml ="";
                                            }else {
                                                BtnHtml ="";
                                            }
                                            //超级用户判断
                                            if ("admin" == login_username){
                                                BtnHtml =
                                                    "<a class=\"btn\" href=\"#\" onclick='Trash("+RspData.data[i].M_id+")'>" +
                                                    "<span class=\"glyphicon glyphicon-trash\" style=\"color: rgb(255, 140, 60);\"></span>" +
                                                    "</a>" ;
                                            }
                                            //截取正文字符串
                                            var text = RspData.data[i].Text;
                                            if (text.length > 110){
                                                text = text.slice(0,110);
                                            }
                                            //背景判断
                                            var bgClasslen =$(".bgcolor").attr("class").length;
                                            if(bgClasslen>20){
                                                var bgClass = "bgcolor_close";
                                            }else {
                                                bgClass = "bgcolor_open";
                                            }
                                            trhtml += "<!--内容列表-->" +
                                                "<div class=\"list-group-item bgcolor_msg "+bgClass+"\" style=\"border-left: none; border-right: none;\" >" +
                                                "<article>" +
                                                "<section >" +
                                                "<div >" +
                                                "<h4>" +
                                                "<a  href=\"/basetext?msg_id="+RspData.data[i].M_id+"&num="+HeartNum+"\">"+RspData.data[i].Hdline+"</a>" +
                                                "</h4>" +
                                                "<div class=\"row clearfix\">" +
                                                "<div class=\"col-md-12 column\">" +
                                                "<div class=\"media\">" +
                                                "<a href=\"#\" class=\"pull-left\">" +
                                                "<img src=\"../static/img/header/"+RspData.data[i].Headpic+"\" width=\"70px\" height=\"70px\" class=\"media-object\" alt='' />" +
                                                "</a>" +
                                                "<div class=\"media-body\">" +
                                                text+"......"+
                                                "</div>" +
                                                "</div>" +
                                                "</div>" +
                                                "</div>" +
                                                "</div>" +
                                                "<footer style=\"padding-top: 10px;\">" +
                                                "<a href=\"#\">" +
                                                "<span>"+RspData.data[i].Name +"</span>" +
                                                "</a>" +
                                                "<span style=\"padding-left: 10px;\">" +
                                                "<span style=\"color: #777777;\">"+RspData.data[i].Cr_time +"</span>" +
                                                "</span>" +
                                                "<a class=\" btn \" href=\"#\" id="+'collect'+RspData.data[i].M_id+">" +
                                                "<span id='"+RspData.data[i].M_id+"'  class='"+heartClass+" glyphicon thumbUpBtn' style=\"color: rgb(255, 0, 0);\" data-container=\"body\" data-toggle=\"popover\" data-placement=\"top\" data-content=\"内容\"></span>" +
                                                "<span class='TmbNum'>"+HeartNum+"</span>" +
                                                "</a>" +
                                                "<a class=\" btn\" href=\"/basetext?msg_id="+RspData.data[i].M_id+"&num="+HeartNum+"\">" +
                                                "<span class=\"glyphicon glyphicon-eye-open\" style=\"color: rgb(175, 175, 230);\"></span>" +
                                                "</a>" +
                                                BtnHtml+
                                                "<span style=\"padding-right: 10px;float: right\">" +
                                                "<span class=\"glyphicon glyphicon-volume-up\" style=\"color: rgb(255, 0, 0);\">: <span style=\"color: rgb(0, 121, 184);\">"+RspData.data[i].Remark +"</span></span>" +
                                                "</span>" +
                                                "</footer>" +
                                                "</section>" +
                                                "<figure>" +
                                                "</figure>" +
                                                "</article>" +
                                                "</div>" +
                                                "<!--内容列表-->"
                                            ;
                                        }
                                        $("#msglistes").html(trhtml);
                                        //点赞处理
                                        $(".thumbUpBtn,.glyphicon-home,.glyphicon-plus,.glyphicon-book,.glyphicon-share,.glyphicon-heart，.glyphicon-eye-open,.dropdown-toggle").click(function (){
                                            //登录判断
                                            alert("请先登录后操作！");
                                        });

                                    });
                                }


                            </script>
                            <div id="pages">
                            </div>
                            <style>
                                ._page_container ._pages {
                                    display: inline-block;
                                    margin: auto;
                                }
                            </style>
                        </div>
                        <div class="col-md-2 column jumbotron" title="main_right">
                            <div class="jumbotron bgcolor bgcolor_open">
                                <h1>
                                    公告：
                                </h1>
                                <p>
                                <div id="myTabContent" class="tab-content">
                                    <div class="tab-pane fade in active" id="home">
                                        <div class="form-group" style="background-color: whitesmoke;">
                                            <textarea readonly id="notice_content" class="form-control" cols="6" rows="12" placeholder="欢迎来到留言part！" style=" border-top:hidden; border-left:hidden ; border-right:hidden ;" ></textarea>
                                        </div>
                                    </div>
                                </div>
                                </p>
                            </div>
                            <script>
                                $(function () {
                                    $("#notice_content").css({background:"whitesmoke"});
                                    //获取公告
                                    $("#NoList tbody").empty();
                                    var NoListUrl = "/notice/list"
                                    $.get(NoListUrl, function (NoData) {
                                        //显示公告
                                        $("#notice_content").val(NoData.NewNotice[0].Content);
                                    });
                                });
                            </script>

                        </div>

                    </div>
                </div>
            </div>
            <div class="row clearfix" title="footer">
                <div class="col-md-12 column">
                    <footer id="footer" class="footer">
                            <div id="friend_link" class=""  style="text-align: center;margin-top: 10px;">
                                友情链接：
                                <a href="//www.vpsor.cn" target="_blank">硅云</a>
                                <a href="//aws.amazon.com" target="_blank">AWS</a>
                                <a href="//www.aliyun.com" target="_blank">阿里云</a>
                                <a href="//cloud.tencent.com" target="_blank">腾讯云</a>
                                <a href="//www.huaweicloud.com" target="_blank">华为云</a>
                                <a href="//cloud.baidu.com" target="_blank">百度云</a>
                                <a href="//www.jdcloud.com" target="_blank">京东云</a>
                                <a href="//www.163yun.com" target="_blank">网易云</a>
                                <a href="//www.yisu.com" target="_blank">亿速云</a>
                                <a href="//www.rongcloud.cn" target="_blank">融云</a>
                                <a href="//www.shanhaibi.com/" target="_blank">山海鲸可视化</a>
                                <a href="http://www.gcpowertools.com.cn" target="_blank">葡萄城控件</a>
                                <a href="//www.chinaz.com/" target="_blank">站长之家</a>
                                <a href="http://dev.yesky.com" target="_blank">天极网</a>
                                <a href="//wetest.qq.com/?from=links_cnblogs" target="_blank">腾讯WeTest</a>
                                <a href="http://www.ucancode.com/" target="_blank">工控组态源码</a>
                            </div>
                            <div class="footer-splitter" style="margin: auto;margin-top: 10px;margin-bottom: 20px;width: 80%;height: 1px;background-color: #999;"></div>
                    </footer>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>